using System;
using System.Configuration;
using System.IO;
using NUnit.Framework;
using ValidationFramework.Configuration;

namespace ValidationFramework.Tests.Configuration
{
    [TestFixture]
    public class ValidationConfigurationSectionTest
    {
        [Test]
        public void ReadConfig()
        {
            var fileMap = new ExeConfigurationFileMap
                                                  {
                                                      ExeConfigFilename = Path.Combine(Environment.CurrentDirectory, "AppConfigSample.xml")
                                                  };

            var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
            var section = configuration.GetSection("validationFrameworkConfiguration");
            var validationConfigurationSection = (ValidationConfigurationSection) section;
            Assert.AreEqual(validationConfigurationSection.MappingDocuments[0].Url, "map1");
            Assert.AreEqual(validationConfigurationSection.MappingDocuments[1].Url, "map2");
        }
    }
}
